string is int f#

38

string is int f# -

let str = Console.ReadLine()
match int.TryParse str with
| true, num -> printfn "%i" num
| _ -> failwithf "'%s' is not an integer" str 

Comments

Submit
0 Comments